package ch.ethz.inf.vs.sunspot;

import java.util.logging.Level;

/**
 * Common constants for the Sun SPOT Driver Instance 
 * 
 * @author Simon Mayer, ETH Zurich
 *
 */
public class Constants {
	
	/**
	 * The loglevel to use for general logging, set when launching the driver
	 */
	public static Level LOGLEVEL = Level.SEVERE;		
	
	/**
	 * If this parameter is set to true, the Synchronization Interval of the Sun SPOT will adapt to its usage pattern - currently not included in the driver
	 */
	public static Boolean TOGGLE_ADAPTIVE_SYNC = true;
	
	/**
	 * Port of Basestation Prefix (i.e. /dev/ttyACMx for Linux, COMx for Windows), set when launching the driver
	 */
	public static String BASESTATION_PREFIX = null;								
	
	/**
	 * Serial Port of Basestation, set when launching the driver
	 */
	public static Integer BASESTATION_PORT = null;
	
	/**
	 * Radiogram Host port for the SPOTs, set when launching the driver
	 */
	public static Integer SPOT_HOST_PORT = null;
	
	/**
	 * Radiogram Host port for the SPOTs, set when launching the driver
	 */
	public static Boolean AUTOCONF = null;

	
	// Names of command line arguments
	public static final String ARG_RESOURCES_PATH = "-configpath=";
	public static final String ARG_SPOTMANAGERPATH = "-spotmanager=";
	public static final String ARG_LOGLEVEL = "-loglevel=";
	public static final String ARG_BASESTATION_PORT = "-basestationport=";
	public static final String ARG_SPOTHOSTPORT = "-spothostport=";
	public static final String ARG_SERVERPORT = "-serverport=";
	public static final String ARG_AUTOCONF = "-autoconf";
	public static final String ARG_HELP = "-help";

	// Intervals, timeouts, thresholds for the SPOT <--> Host communication 
	public static Integer SPOT_SYNC_INTERVAL = 0;
	public static Integer SPOT_SYNC_MAXINTERVAL = 20000;
	public static Integer SPOT_SYNC_MININTERVAL = 0;
	public static Integer SPOT_SYNC_RECEIVETIMEOUT = 5000;	
	public static Integer SPOT_HOST_TIMEOUT = 5000;				// This controls the timeout of the Basestation-connection that listens for new SPOTs. Influences how fast SPOT Host Port changes are put into effect.  
	public static Double SPOT_SYNC_TOLERANCE_REL = 0.1;
	public static Integer SPOT_SYNC_TOLERANCE_ABS = 2000;
	public static Integer SPOT_CONNECTIVITY_INTERVAL = 500;
}
